package com.woniuxy.Test;

import com.woniuxy.Service.ClazzService;
import com.woniuxy.Service.UserService;
import com.woniuxy.entity.clazz;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Map;

/**
 * @Author：向天浩
 * @Date：2022/1/19 11:34
 * @Description :TODO
 */

public class Test {
    public static void main(String[] args) {
//    ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
//        UserService userService = applicationContext.getBean("userService", UserService.class);
//        for (Map<String, String> stringStringMap : userService.findAll()) {
//            System.out.println(stringStringMap);
//        }
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("applicationContext.xml");
        ClazzService clazzService = applicationContext.getBean("ClazzService", ClazzService.class);
        //查询
//        clazz clazz = clazzService.find(1001);
//        System.out.println(clazz);

        //新增
//        int insert = clazzService.insert(1003, "87期");
//        if (insert > 0) {
//            System.out.println("成功");
//        }else {
//            System.out.println("失败");
//        }

        //修改
//        int update = clazzService.update(1003, "88期");
//        if (update > 0) {
//            System.out.println("成功");
//        }else {
//            System.out.println("失败");
//        }

        //删除
//        int delete = clazzService.delete(1003);
//        if (delete > 0) {
//            System.out.println("成功");
//        }else {
//            System.out.println("失败");
//        }
    }
}